/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.hibernate.Criteria;
import org.hibernate.Session;
import pojo.PaisPojo;
import resources.ConfHibernate;

/**
 *
 * @author BAENA
 */
public class PaisDao {
    
    public static List<PaisPojo> getListaPais(){
        List<PaisPojo> listaPais = new ArrayList<PaisPojo>();
        Session session = ConfHibernate.getSessionFactory().getCurrentSession();
        try {
            System.out.println("Pidiendo a Hiernate.");
            session.beginTransaction();
            Criteria criteria = session.createCriteria(PaisPojo.class);
            listaPais = criteria.list();
            session.getTransaction().commit();
        } catch (Exception ex) {
            Logger.getLogger(PaisPojo.class.getName()).log(Level.SEVERE,"Problema al obtener la lista de Juegos");
            session.getTransaction().rollback();
        }
        return listaPais;        
    }    
}
